@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
        .layui-form-label {width: 100px;}
        .layui-input-block {margin-left: 138px;}
        .layui-input, .layui-textarea {width: 86%;}
        .layui-form-select .layui-edge {right: 16%;}
        .layui-form-select dl {min-width: 86%;}
        .layui-input.layui-bg-gray {line-height: 38px;}
        .new-table {margin: 20px 0;}
    </style>
@endsection
@include('Home.User.Common._meta')
<!----  新增： 兼职者  ---->
<div class="modal-content new-table" id="addNew-content2">
    <form class="layui-form modal-client-info" action="" id="form-user" lay-filter="form-user">
        <div class="modal-func-btns">
            <a href="javascript:;" class="modal-save-btn" onclick="subForm('{{route('person_edit',$obj->id)}}')" title="保存"><i class="icon icon-save"></i></a>
            <a href="javascript:location.replace(location.href);" class="modal-edit-btn" title="重置"><i class="icon icon-edit"></i></a>
        </div>
        @include('Home.User.Common._msg')
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>用户名</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']))
                    <input type="text" name="username" lay-verify="required" placeholder="请输入用户名" value="{{$obj->username}}" autocomplete="off" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->username}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="text" name="password" lay-verify="required" placeholder="请输入密码" value="" autocomplete="off" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>职务</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']))
                    <input type="text" name="duties" lay-verify="required" placeholder="请输入职务" value="{{$obj->duties}}" autocomplete="off" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->duties}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']))
                    <input type="text" name="describe" lay-verify="required" placeholder="请输入描述" value="{{$obj->describe}}" autocomplete="off" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->describe}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="1" title="男" @if($obj->sex == 1) checked @endif>
                <input type="radio" name="sex" value="2" title="女" @if($obj->sex == 2) checked @endif>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">生日</label>
            <div class="layui-input-block">
                <input type="text" name="birthday" id="birthday" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{{$obj->birthday}}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">籍贯</label>
            <div class="layui-input-block">
                <input type="text" name="native" lay-verify="" placeholder="请输入籍贯" autocomplete="off" value="{{$obj->native}}" class="layui-input">
            </div>
        </div>
        {{--<div class="layui-form-item">--}}
            {{--<label class="layui-form-label">身份证号</label>--}}
            {{--<div class="layui-input-block">--}}
                {{--<input type="text" name="card_id" lay-verify="" placeholder="请输入身份证号" autocomplete="off" value="{{$obj->card_id}}" class="layui-input">--}}
            {{--</div>--}}
        {{--</div>--}}
        <div class="layui-form-item">
            <label class="layui-form-label">毕业时间</label>
            <div class="layui-input-block">
                <input type="text" name="graduation_time" id="graduation_time" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{{$obj->graduation_time}}">
            </div>
        </div>
        {{--<div class="layui-form-item">--}}
            {{--<label class="layui-form-label">学历</label>--}}
            {{--<div class="layui-input-block">--}}
                {{--<select name="education" lay-verify="required">--}}
                    {{--<option value=""></option>--}}
                    {{--<option value="1" @if($obj->education == 1) selected @endif>大专</option>--}}
                    {{--<option value="2" @if($obj->education == 2) selected @endif>本科</option>--}}
                    {{--<option value="3" @if($obj->education == 3) selected @endif>硕士</option>--}}
                    {{--<option value="4" @if($obj->education == 4) selected @endif>博士</option>--}}
                {{--</select>--}}
            {{--</div>--}}
        {{--</div>--}}
        {{--<div class="layui-form-item">--}}
            {{--<label class="layui-form-label">专业</label>--}}
            {{--<div class="layui-input-block">--}}
                {{--<input type="text" name="major" lay-verify="" placeholder="请输入专业" autocomplete="off" value="{{$obj->major}}" class="layui-input">--}}
            {{--</div>--}}
        {{--</div>--}}
        <div class="layui-form-item">
            <label class="layui-form-label">电话</label>
            <div class="layui-input-block">
                <input type="text" name="phone" lay-verify="" placeholder="请输入电话" autocomplete="off" value="{{$obj->phone}}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input type="text" name="email" lay-verify="" placeholder="请输入邮箱" autocomplete="off" value="{{$obj->email}}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">微信</label>
            <div class="layui-input-block">
                <input type="text" name="wechat" lay-verify="" placeholder="请输入微信" autocomplete="off" value="{{$obj->wechat}}" class="layui-input">
            </div>
        </div>
    </form>
</div>
@section('footer')
    <script>
        layui.use(['laydate','form'], function(){
            var laydate = layui.laydate;
            var form = layui.form;

            form.val("form-user", {
                "type": "{{$obj->type}}", // "name": "value"
                "leader_id": "{{$obj->leader_id}}" // "name": "value"
            });

            @if($obj->type != 1)
                $('#leader_id').parent().parent().hide();
                form.val("form-user", {
                    "leader_id": "" // "name": "value"
                });
            @endif

            //执行一个laydate实例
            laydate.render({
                elem: '#birthday', //指定元素
                type: 'date'
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#graduation_time', //指定元素
                type: 'month'
            });


            form.on('select(type)', function(data){
                if (data.value != 1) {
                    $('#leader_id').parent().parent().hide();
                    form.val("form-user", {
                        "leader_id": "" // "name": "value"
                    });
                }else{
                    $('#leader_id').parent().parent().show();
                    form.val("form-user", {
                        "leader_id": "" // "name": "value"
                    });
                }
            });
        });
    </script>
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')